package com.yiminer.jobs;

import java.util.List;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.yiminer.to.User;
import com.yiminer.util.TimerUtil;

public class StarterJob extends QuartzJobBean {

	protected void executeInternal(JobExecutionContext context)
			throws JobExecutionException {
		System.out.println("================Start=====================");
		try {
			List<User> users = TimerUtil.getAllRegistedUsers();
			for (User user : users) {
				SubmitThread submitThread = new SubmitThread(user);
				submitThread.start();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("================End=======================");
	}

}
